home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
LDB171.ARJ
/
MINT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-12
|
2KB
|
121 lines
/*
mint.cpp -- Loose Data Binder v 1.7:
mutually owned and persistent
"int form."
(C) Copyright 1992 John W. Small
All rights reserved
PSW / Power SoftWare
P.O. Box 10072
McLean, Virginia 22102 8072 USA
(703) 759-3838
This file was created by cloning fmutual.cpp
and
replacing: with:
CLASS Mint
CPTR MinT
BASE Mutual
*/
#ifndef Mint_HPP
#include "mint.hpp"
#endif
int Mint::initData(int i)
{
// initialize any Mint-declared data
// members here
this->i = i;
return 1; // success
}
void Mint::fput(ostream& os)
{
Mutual::fput(os);
os << i << Mendm;
if (!os)
error("unable to store Mint "
"data on stream");
}
MutuaL Mint::fget(istream& is, MutuaL InstancE)
{
int newed;
MinT thiS;
int i;
is >> i >> Mnextm;
if (!is) {
serror("unable to load Mint "
"data from stream",
ID_Mint);
return MutuaL0;
}
if (InstancE) {
newed = 0;
thiS = (MinT) InstancE;
}
else {
if ((thiS = new Mint(initVFTsEtc))
== MinT0) {
serror("unable to construct "
"new Mint for "
"loading",
ID_Mint);
return MutuaL0;
}
newed = 1;
InstancE = (MutuaL) thiS;
}
if (!Mutual::fget(is,InstancE)) {
if (newed)
delete (voiD) thiS;
return MutuaL0;
}
if (!thiS->initData(i)) {
serror("unable to initialize Mint "
"from reloaded stream data",
ID_Mint);
if (newed)
delete (voiD) thiS;
return MutuaL0;
}
return InstancE;
}
Mint::Mint (int i) : Mutual(initVFTsEtc)
{
(void) initData(i);
}
Mint::Mint(Mint& c) : Mutual(c)
{
// copy initializer constructor
this->i = c.I();
}
int Mint::operator=(Mutual& m)
{
this->i = ((MinT)&m)->I();
// Assignment is not the same as copy initialize!
// In this trival case the semantics are the same.
return 1; // enabled
}
MutuaL Mint::clone()
{
// invokes copy initializer constructor
return (MutuaL) new Mint(*this);
}
Mint::~Mint()
{
// ???
}